package com.eight.cloud.openfeign.message.enums;

import com.eight.cloud.core.global.exception.ParameterException;
import com.fasterxml.jackson.annotation.JsonCreator;
import lombok.Getter;

/**
 * 路由键枚举
 *
 * @EnumName: RoutingKeyEnum
 * @Author: TXC
 * @Date: 2025-08-15 10:10
 **/
@Getter
public enum RoutingKeyEnum {
    WEBSOCKET_ROUTING_KEY("message.notify.websocket");
    private final String value;

    RoutingKeyEnum(String value) {
        this.value = value;
    }
    /**
     * 根据值获取枚举
     *
     * @param value 值
     * @return 枚举
     */
    @JsonCreator
    public static RoutingKeyEnum getByValue(String value) {
        for (RoutingKeyEnum routingKeyEnum : RoutingKeyEnum.values()) {
            if (routingKeyEnum.value.equals(value)) {
                return routingKeyEnum;
            }
        }
        throw new ParameterException("No enum constant with value: " + value);
    }
}
